package com.jiangtour.service.impl;

import com.jiangtour.dataobject.ProductCategory;
import com.jiangtour.repository.ProductCategoryRepository;
import com.jiangtour.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author Administrator
 * @Title: CategoryServiceImpl
 * @ProjectName site
 * @Description:
 * @date 2018/12/24/02415:55
 */

@Service
public class CategoryServiceImpl  implements CategoryService {

    @Autowired
    private ProductCategoryRepository productCategoryRepository;


    @Override
    public ProductCategory findOne(Integer categoryId) {
        return productCategoryRepository.findById(categoryId).get();
    }

    @Override
    public List<ProductCategory> findAll() {
        return productCategoryRepository.findAll();
    }

    @Override
    public ProductCategory save(ProductCategory productCategory) {
        return productCategoryRepository.save(productCategory);
    }

    @Override
    public List<ProductCategory> findCategoryAscription(String ascriptionId) {
        return productCategoryRepository.findByCategoryAscription(ascriptionId);
    }
}
